import * as employeesListApi from '@/api/employees'

const state = {
  employeesList: {},
  // 获取员工简单列表
  employees: []
}
const mutations = {
  SET_GETEMPLOYEESLIST_LIST(state, newValue) {
    state.employeesList = newValue
  },
  SET_GETEMPLOYEES_LIST(state, newValue) {
    state.employees = newValue
  }
}

const actions = {
  async updateGetEmployeesList({ commit }, params) {
    const res = await employeesListApi.getEmployeesList(params)
    commit('SET_GETEMPLOYEESLIST_LIST', res)
  },
  async updateGetEmployees({ commit }) {
    const res = await employeesListApi.getEmployee()
    commit('SET_GETEMPLOYEES_LIST', res)
  }
}

export default {
  namespaced: true,
  state,
  mutations,
  actions
}
